<template>
  <el-menu
    background-color="#545c64"
    :default-openeds="opens"
    text-color="#fff"
    active-text-color="#ffd04b"
    style="width: 200px"
    :collapse-transition="false"
    :collapse="isCollapse"
    router
  >
    <div
      style="
        height: 60px;
        line-height: 60px;
        text-align: center;
        padding: 0 0px;
      "
    >
      <b style="color: #fff" v-show="logoTextShow">管理综合系统</b>
    </div>

    <el-menu-item index="/pandect">
      <i class="el-icon-house"></i>
      <span slot="title">首页</span>
    </el-menu-item>

    <el-submenu index="1-1">
      <template slot="title">
        <i class="el-icon-s-home"></i>
        <span slot="title">数据</span>
      </template>
      <el-submenu index="1-1-1">
        <template slot="title">
          <i class="el-icon-coffee"></i>
          <span>数据看板</span>
        </template>
        <el-menu-item index="EquipmentMaintenance">项目数据看板</el-menu-item>
        <el-menu-item index="EquipmentType">数据状态看板</el-menu-item>
      </el-submenu>
      <el-submenu index="1-1-2">
        <template slot="title">
          <i class="el-icon-coffee"></i>
          <span>报表中心</span>
        </template>
        <el-menu-item index="EquipmentMaintenance">
          <i class="el-icon-coffee"></i>报表下载</el-menu-item
        >
      </el-submenu>
      <el-submenu index="1-1-3">
        <template slot="title">
          <i class="el-icon-coffee"></i>
          <span>风险中心</span>
        </template>
        <el-menu-item index="EquipmentMaintenance">预警配置</el-menu-item>
      </el-submenu>
    </el-submenu>

    <el-submenu index="2-1">
      <template slot="title">
        <i class="el-icon-s-home"></i>
        <span slot="title">备件管理</span>
      </template>
      <el-submenu index="2-1-1">
        <template slot="title">
          <i class="el-icon-coffee"></i>
          <span>故障报修</span>
        </template>
        <el-menu-item index="EquipmentMaintenance">故障报修</el-menu-item>
        <el-menu-item index="EquipmentType">故障类型</el-menu-item>
        <el-menu-item index="EquipmentExperience">故障经验</el-menu-item>
      </el-submenu>
    </el-submenu>
    <el-submenu index="3-1">
      <template slot="title">
        <i class="el-icon-s-home"></i>
        <span slot="title">项目</span>
      </template>
      <el-submenu index="3-1-1">
        <template slot="title">
          <i class="iconfont icon-shigong"></i>&nbsp;
          <span slot="title">施工管理</span>
        </template>
        <el-menu-item index="/projectApproval"
          ><i class="iconfont icon-shigongjieduan"></i
          >&nbsp;施工立项</el-menu-item
        >
        <el-menu-item index="/ProjectDisclosure"
          ><i class="iconfont icon-shigongrizhi"></i
          >&nbsp;项目交底</el-menu-item
        >
      </el-submenu>
    </el-submenu>
  </el-menu>
</template>

<script>
export default {
  name: "Aside",
  props: {
    isCollapse: Boolean, //控制侧边收缩
    logoTextShow: Boolean, //后台管理文字隐藏
  },
  data() {
    return {
      //菜单默认展开
      opens: localStorage.getItem("menuList")
        ? JSON.parse(localStorage.getItem("menuList")).map((v) => v.id + "")
        : [],
    };
  },
};
</script>

<style scoped>
/*解决收缩菜单文字不消失问题*/
.el-menu--collapse span {
  visibility: hidden;
}
</style>